Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Use  a  Search  to  Modify  Similar  Active  Directory  Objects  

 Content of Use a Search to Modify Similar Active Directory Objects.vbs
MD5 Hash: 2DA0CF827DD2916818588E6D7E41A0D6
' Description: Searches for all computers that begin with the letters "ATL" in a domain and any child domain, and then modifies the location attribute of all computers found.


Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

objCommand.CommandText = _
";" & _
"(&(objectCategory=Computer)(cn=ATL*));" & _
"ADsPath;subtree"

Set objRecordSet = objCommand.Execute

Do Until objRecordset.EOF
strADsPath = objRecordset.Fields("ADsPath")
Set objComputer = GetObject(strADsPath)
objComputer.Put "location", "Atlanta, Georgia"
objComputer.SetInfo
objRecordSet.MoveNext
Loop

WScript.Echo objRecordSet.RecordCount & _
" computers objects modified."

objConnection.Close

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a